package com.ctgu.examonline.service.serviceImpl;

import com.ctgu.examonline.dao.TeacherDao;
import com.ctgu.examonline.entity.Teacher;
import com.ctgu.examonline.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class TeacherServiceImpl implements TeacherService {

    @Resource
    private TeacherDao teacherDao;

    //保存
    @Override
    public void save(Teacher teacher) {
        teacherDao.save(teacher);
    }

    //删除
    @Override
    public void remove(Integer tea_no) {
        teacherDao.remove(tea_no);
    }

    //更新
    @Override
    public void update(Teacher teacher) {
        teacherDao.update(teacher);
    }

    //登录
    @Override
    public Teacher login(Integer tea_no, String tea_pwd) {
        return teacherDao.findByNoAndPassword(tea_no,tea_pwd);
    }

    //查询所有教师信息
    @Override
    public List<Teacher> listTeacher() {
        return teacherDao.listAllTeacherInfo();
    }
}
